<?php
$pathinfo = pathinfo(__FILE__);
preg_match('/.+(?=wp-content)/', $pathinfo['dirname'], $match);
$pathNeeded = preg_replace('/\ /', '/', $match[0]);
require_once($pathNeeded . 'wp-load.php'); //refer to wp-load to use instruction
/*
 * remove file in admin page
 */
if(isset($_POST['imageName'])){
    $key = array_search($_POST['imageName'], $_SESSION['aImages']); 
    unset($_SESSION['aImages'][$key]);
    $_SESSION['aRemovedImg'][] = $_POST['imageName'];
    
}
